/**
 * 
 */
package org.dragonfire.dasm.directives;

import java.util.ArrayList;

import org.dragonfire.dasm.Command;
import org.dragonfire.dasm.Listing;
import org.dragonfire.dasm.DirectiveManager.Directive;

/**
 * <code>#ORG</code> changes the current PC value that is used for absolute
 * jumps, relative jumps, label values, etc.<br />
 * <br />
 * Format:<br />
 * <code>#ORG <i>&lt;expression&gt;</i></code><br />
 * <br />
 * Parameters:<br />
 * <table>
 * <tr>
 * <td><code>expression</code></td>
 * <td>(Integer) The new value of the program counter.</td>
 * </tr>
 * </table><br />
 * Errors:<br />
 * <table>
 * <tr>
 * <td><code>ERROR_NOT_ENOUGH_ARGS</code></td>
 * <td>Thrown if <code>expression</code> is not defined</td>
 * </tr>
 * <tr>
 * <td><code>ERROR_INT_REQUIRED</code></td>
 * <td>Thrown if <code>expression</code> is not an integer</td>
 * </tr>
 * </table>
 * 
 * @author Darth Android
 * @version 2.0
 * @see org.dragonfire.dasm.preprocessor.Preprocessor#setPC(int)
 */
public class Org extends Directive {

	/**
	 * {@inheritDoc}
	 */
	@Override
	public ArrayList<Listing> pass1(Command c) {
		// change the current PC value
		getPreprocessor().setPC(evalInt(c.getParam(0)));
		return null;
	}
}
